<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>AdminLTE 3 | Dashboard</title>


<!--    遮罩层-->
    <link rel="stylesheet" href="plugins/loading/css/animate.css">
    <link rel="stylesheet" href="plugins/loading/css/global.css">
    <link rel="stylesheet" href="plugins/loading/css/loading.css">



    <!-- Google Font: Source Sans Pro -->
    <link rel="stylesheet"
          href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,700&display=fallback">
    <!-- Font Awesome 物理图标-->
    <link rel="stylesheet" href="plugins/fontawesome-free/css/all.min.css">
    <link rel="stylesheet" href="plugins/fontawesome-free-6.4.0-web/css/all.css">

    <!-- Ionicons -->
    <!--  <link rel="stylesheet" href="https://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css">-->
    <link rel="stylesheet" href="css/ionicons.min.css">
    <!-- Tempusdominus Bootstrap 4 -->
    <link rel="stylesheet" href="plugins/tempusdominus-bootstrap-4/css/tempusdominus-bootstrap-4.min.css">

    <!-- Theme style -->
    <link rel="stylesheet" href="css/adminlte.min.css">


</head>
<body class="hold-transition sidebar-mini layout-fixed">

<div class="wrapper">

    <!-- 顶部导航 -->
    <nav class="main-header navbar navbar-expand navbar-white navbar-light">
        <ul class="navbar-nav">
            <li class="nav-item">
                <a class="nav-link" data-widget="pushmenu" href="#" role="button"><i class="fas fa-bars"></i></a>
            </li>
        </ul>

        <!-- Right navbar links -->
        <ul class="navbar-nav ml-auto">
            <li class="nav-item">
                <a class="nav-link" data-widget="fullscreen" href="#" role="button">

                    <i class="fa-solid fa-person"></i>登陆者：<span id="loginUser">xxxxxx</span>
                    <!--                    <i class="fas fa-expand-arrows-alt"></i>登陆者：xxxxxx-->
                </a>
            </li>
            <li class="nav-item">
                <a class="nav-link" data-widget="control-sidebar" data-slide="true" href="#" role="button">
                    <i class="fa-solid fa-calendar-days"></i>当前时间：<span id="sTime"></span>
                </a>
            </li>
        </ul>
    </nav>
    <!-- 顶部导航 -->


    <!-- 左边菜单 -->
    <aside class="main-sidebar sidebar-dark-primary elevation-4">
        <!-- Brand Logo -->
        <a href="#" class="brand-link">
            <img src="img/AdminLTELogo.png" alt="AdminLTE Logo" class="brand-image img-circle elevation-3"
                 style="opacity: .8">
            <span class="brand-text font-weight-light">企业后台管理V1.0</span>
        </a>

        <!-- Sidebar -->
        <div class="sidebar">
            <!-- Sidebar Menu -->
            <nav class="mt-2">
                <ul class="nav nav-pills nav-sidebar flex-column" data-widget="treeview" role="menu"
                    data-accordion="false">
                    <!-- Add icons to the links using the .nav-icon class
                         with font-awesome or any other icon font library -->

                    <li class="nav-header">新闻管理</li>
                    <li class="nav-item">
                        <a href="javascript:void(0);" onclick="menu('newsType.html')" class="nav-link">
                            <i class="fa-solid fa-gear"></i>
                            <p>
                                新闻类型
                            </p>
                        </a>
                    </li>
                    <li class="nav-item">
                        <a href="javascript:void(0);" onclick="menu('b.html')" class="nav-link">
                            <i class="fa-solid fa-gear"></i>
                            <p>
                                新闻内容
                            </p>
                        </a>
                    </li>
                    <li class="nav-header">产品管理</li>
                    <li class="nav-item">
                        <a href="#" class="nav-link">
                            <i class="nav-icon far fa-image"></i>
                            <p>
                                产品类型
                            </p>
                        </a>
                    </li>
                    <li class="nav-item">
                        <a href="#" class="nav-link">
                            <i class="nav-icon far fa-image"></i>
                            <p>
                                产品内容
                            </p>
                        </a>
                    </li>
                    <li class="nav-header">公司信息</li>
                    <li class="nav-item">
                        <a href="#" class="nav-link">
                            <i class="nav-icon far fa-image"></i>
                            <p>
                                公司简介
                            </p>
                        </a>
                    </li>
                    <li class="nav-item">
                        <a href="#" class="nav-link">
                            <i class="nav-icon far fa-image"></i>
                            <p>
                                联系我们
                            </p>
                        </a>
                    </li>
                    <li class="nav-item">
                        <a href="#" class="nav-link">
                            <i class="nav-icon far fa-image"></i>
                            <p>
                                招贤纳士
                            </p>
                        </a>
                    </li>
                    <li class="nav-header">留言管理</li>
                    <li class="nav-item">
                        <a href="javascript:void(0);" onclick="menu('message.html')" class="nav-link">
                            <i class="nav-icon far fa-image"></i>
                            <p>
                                留言内容
                            </p>
                        </a>
                    </li>
                    <li class="nav-header">系统管理</li>
                    <li class="nav-item">
                        <a href="Javascript:void(0)"  onclick="aLogout()" class="nav-link">
                            <i class="nav-icon far fa-image"></i>
                            <p>
                                退出系统
                            </p>
                        </a>
                    </li>
                </ul>
            </nav>
            <!-- /.sidebar-menu -->
        </div>
        <!-- /.sidebar -->
    </aside>
    <!-- 左边菜单 -->

    <!-- 中间内容 -->
    <div id="mainInfo" class="content-wrapper">

    </div>
    <!-- 中间内容 -->


    <!--脚注-->
    <footer class="main-footer">
        <strong>Copyright &copy; 2023-2033 <a href="#">企业管理系统V1.0</a>.</strong>
        All rights reserved.
        <div class="float-right d-none d-sm-inline-block">
            <b>Version</b> 3.1.0-rc
        </div>
    </footer>
    <!--脚注-->

</div>
<!-- ./wrapper -->

<!-- jQuery -->
<script src="js/jquery-3.7.0.js"></script>
<!-- Bootstrap 4 -->
<script src="plugins/bootstrap/js/bootstrap.bundle.min.js"></script>
<!-- Tempusdominus Bootstrap 4 -->
<script src="plugins/tempusdominus-bootstrap-4/js/tempusdominus-bootstrap-4.min.js"></script>
<!-- AdminLTE App -->
<script src="js/adminlte.js"></script>
<!--遮罩层-->
<script src="plugins/loading/js/loading.js"></script>

</body>
</html>


<script>

    //遮罩层开启
    function loadingOpen(){
        $('body').loading({
            loadingWidth:240,
            title:'请稍等!',
            name:'test',
            discription:'数据加载中.........',
            direction:'column',
            type:'origin',
            // originBg:'#71EA71',
            originDivWidth:40,
            originDivHeight:40,
            originWidth:6,
            originHeight:6,
            smallLoading:false,
            loadingMaskBg:'rgba(0,0,0,0.2)'
        });
    }
    //遮罩层关闭
    function loadingClose() {
        removeLoading('test');
    }


    //遮罩层关闭

    //定义一个方法，让我们的菜单能够点击
    //HTML可以使用属性【一般是on开头的事件属性】调用方法
    function menu(a) {
        $("#mainInfo").load(a);
    }

    //启动时间
    var excute=function () {
        var a=new Date();
        $("#sTime").text(a.getFullYear()+"年"+(a.getMonth()+1)+"月"+a.getDate()+" "+a.getHours()+":"+a.getMinutes()+":"+a.getSeconds());
    };

    //dom加载完毕后执行
    $(function () {
        //每过多少毫秒执行方法
        window.setInterval(excute,1000);
        //初始化默认显示的内容界面
        $("#mainInfo").load("newsType.html");



        //todo 获取登陆者信息
        $.ajax({
            url: "/user/get.action",
            dataType: "json",
            type: "get",
            beforeSend: function (XMLHttpRequest) {
                console.log("准备开始请求后端..............");
            },
            success: function (data, textStatus, jqXHR) {
                console.log("响应成功..............");
                if (data.result) {
                    $("#loginUser").text(data.data);
                }
            },
            error: function (XMLHttpRequest, textStatus, errorThrown) {
                console.log("响应失败.............." + errorThrown);
            },
            complete: function (XMLHttpRequest, textStatus) {
                console.log("响应结束..............");
            }
        });




    });





    //处理登出
    function aLogout() {
        $.ajax({
            url: "/user/logout.action",
            dataType: "json",
            type: "get",
            beforeSend: function (XMLHttpRequest) {
                console.log("准备开始请求后端..............");

            },
            success: function (data, textStatus, jqXHR) {
                console.log("响应成功..............");
                if (data.result) {
                    window.location="/admin/index.html";
                } else {
                    window.alert(data.mess);
                }
            },
            error: function (XMLHttpRequest, textStatus, errorThrown) {
                console.log("响应失败.............." + errorThrown);
            },
            complete: function (XMLHttpRequest, textStatus) {
                console.log("响应结束..............");

            }
        });
    }


</script>